<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class GiRecord extends Model
{
    protected $table = 'gi_records';

    protected $fillable = [
    	'prev_gi',
    	'next_gi',
    	'wechat_user_id',
    	'created_at'
    ];

    public static $SQL_SELECT_ID_AND_TODAY = "SELECT * FROM `gi_records` WHERE `id` = ? AND wechat_user_id = ? AND date_format(gi_records.created_at,'%Y-%m-%d')=date_format(now(),'%Y-%m-%d')";

    public static $SQL_SELECT_TODAY = "SELECT * FROM `gi_records` WHERE date_format(gi_records.created_at,'%Y-%m-%d')=date_format(now(),'%Y-%m-%d') AND wechat_user_id = ?";
}
